﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using CE.User;
using CE.Global;
using CE.Database;
using CE.CarInsurance;
using CE.PersonalAccident;

public partial class SiteUser_CarInsurance_ViewCarInsuranceOldCustomer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session[CE.Global.General.UserId] == null)
        {
            Response.Redirect("~/SiteUserSecureLogin.aspx");
        }

        if (!IsPostBack)
        {
            UpdateScriptUrl();
            SetCarInsuranceRunNewCustomerAndQuoteLink();
            txtAgentId.Text = Session[General.UserId].ToString();
            DateTime dtNow = new DateTime(2011,01,15);
            
            //for (int i = 0; i < 7; i++)
            //{
            //    DateTime dtTemp = dtNow.AddDays(i);
            //    string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
            //    ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            //}

            //dtNow = new DateTime(2011,02,27);

            //for (int i = 0; i < 3; i++)
            //{
            //    DateTime dtTemp = dtNow.AddDays(i);
            //    string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
            //    ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            //}

            dtNow = new DateTime(2011, 03, 01);
            ddlCommenceDate.Items.Add(new ListItem(dtNow.ToString("dd/MMM/yyyy"), dtNow.ToString("yyyyMMdd")));

            dtNow = new DateTime(2012, 03, 01);
            ddlCommenceDate.Items.Add(new ListItem(dtNow.ToString("dd/MMM/yyyy"), dtNow.ToString("yyyyMMdd")));

            
            dtNow = new DateTime(2011, 04, 01);

            for (int i = 0; i < 5; i++)
            {
                DateTime dtTemp = dtNow.AddDays(i);
                string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
                ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            }

            dtNow = new DateTime(2011, 04, 20);

            for (int i = 0; i < 10; i++)
            {
                DateTime dtTemp = dtNow.AddDays(i);
                string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
                ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            }

            //dtNow = new DateTime(2012, 02, 27);

            //for (int i = 0; i < 4; i++)
            //{
            //    DateTime dtTemp = dtNow.AddDays(i);
            //    string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
            //    ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            //}

            dtNow = new DateTime(2012, 04, 01);

            for (int i = 0; i < 5; i++)
            {
                DateTime dtTemp = dtNow.AddDays(i);
                string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
                ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            }

            dtNow = new DateTime(2012, 04, 20);

            for (int i = 0; i < 10; i++)
            {
                DateTime dtTemp = dtNow.AddDays(i);
                string strDate = dtTemp.Date.Year.ToString("0000") + dtTemp.Date.Month.ToString("00") + dtTemp.Date.Day.ToString("00");
                ddlCommenceDate.Items.Add(new ListItem(dtTemp.ToString("dd/MMM/yyyy"), strDate));
            }
            //LoadLiberty();
        }
    }

    private void SetCarInsuranceRunNewCustomerAndQuoteLink()
    {
        Account _account = new Account();
        AccountDB _accountdb = new AccountDB();
        Int64 _AgentId = Convert.ToInt64(Session[CE.Global.General.UserId].ToString());
        string _guid = _accountdb.GetGUID(_AgentId);
        string carInsuranceURL = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CIServerPath");
        hplCarNewQuote.NavigateUrl = carInsuranceURL + "AgentLogin.aspx?uid=" + _AgentId.ToString() +
                                "&guid=" + _guid + "&pcid=" + ddlProviderCompany.Text;
    }

    protected void grvCarInsurance_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (grvCarInsurance.Rows.Count > 0 && grvCarInsurance.SelectedIndex >= 0)
        {
            DataKey myData = grvCarInsurance.SelectedDataKey;
            txtCustomerId.Text = myData[0].ToString();
            txtCarId.Text = myData[1].ToString();
            txtCarPolicyId.Text = myData[2].ToString();
            txtContactNo.Text = myData[3].ToString();
            txtCIRemark.Visible = false;
            txtPARemark.Visible = false;
            string carInsuranceURL = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CIServerPath");
            string paInsuranceURL = CE.Configuration.MyConfigurationManager.GetAppSettingValue("PAServerPath");
            hplNewQuote.NavigateUrl = carInsuranceURL + "AgentLogin.aspx?uid=" + Session[General.UserId].ToString() +
                                "&cid=" + txtCustomerId.Text + "&pcid=" + ddlProviderCompany.Text;
            hplPANewQuote.NavigateUrl = paInsuranceURL + "AgentLogin.aspx?uid=" + Session[General.UserId].ToString() +
                                "&cid=" + txtCustomerId.Text + "&pcid=" + ddlProviderCompany.Text;
            hplPANewUser.NavigateUrl = paInsuranceURL + "AgentLogin.aspx?uid=" + Session[General.UserId].ToString() +
                                "&pcid=" + ddlProviderCompany.Text;
            hplReRunQuote.NavigateUrl = carInsuranceURL + "AgentLogin.aspx?uid=" + Session[General.UserId].ToString() + "&carid=" + txtCarId.Text + "&policyid=" + txtCarPolicyId.Text +
                                "&cid=" + txtCustomerId.Text + "&pcid=" + ddlProviderCompany.Text;
            txtServerPath.Text = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CIProposalServerPath");

            txtCarResultId.Text = "0";
            txtCXCRMId.Text = "0";
            txtCIRemark.Text = "";
            txtPARemark.Text = "";
            lblCallStatusMessage.Text = "";
            //ddlCallFor.Text = "-1";
            ddlCICallStatus.Text = "-1";
            ddlPACallStatus.Text = "-1";
            txtCallStatusId.Text = "0";
            hplQuoteResultPrintPreview.NavigateUrl = "#";

            if (txtCustomerId.Text != string.Empty && txtCarId.Text != string.Empty)
            {
                ddlCallFor.Text = "100";
                ddlCallFor_SelectedIndexChanged(sender, e);

                grvCarInsuranceCheapestQuote.DataBind();

                hplQuoteResultPrintPreview.NavigateUrl = "QuoteResultPrintPreview.aspx?custid=" + txtCustomerId.Text + "&carid=" + txtCarId.Text;

                MyDatabase _db = new MyDatabase();
                //Customer Details
                string _strSelect = "select P.DOB, P.Gender, M.Description MaritalStatus, O.Description Occupation, P.JobNature, P.YearDriveSg from tblCEUsrProfile P "
                                    + "INNER JOIN tblMaritalStatusInfo M ON P.MaritalStatus = M.MaritalStatusId "
                                    + "INNER JOIN tblOccupationInfo O ON P.Occupation = O.OccupationId "
                                    + "Where P.RefCEUserId = " + txtCustomerId.Text;
                DataTable _dtSelect = new DataTable("dtSelect");
                _dtSelect = _db.GetDataTable(_strSelect);
                if (_dtSelect != null && _dtSelect.Rows.Count > 0)
                {
                    lblMaritalStatus.Text = _dtSelect.Rows[0]["MaritalStatus"].ToString();
                    lblGender.Text = _dtSelect.Rows[0]["Gender"].ToString();
                    lblDOB.Text = Convert.ToDateTime(_dtSelect.Rows[0]["DOB"].ToString()).ToString("dd/MMM/yyyy");
                    lblOccupation.Text = _dtSelect.Rows[0]["Occupation"].ToString();
                    lblJobNature.Text = _dtSelect.Rows[0]["JobNature"].ToString();
                    lblDriveInSG.Text = _dtSelect.Rows[0]["YearDriveSg"].ToString();
                }
                _dtSelect = null;
                _dtSelect = new DataTable("dtSelect");

                _strSelect = " Select CD.MakeModelDesc, CD.RegYear, CD.IsPeak, CD.Info17, P.CompanyName CurrentInsurer from tblCarDetail CD"
                            + " INNER JOIN tblPreInsurer P ON CAST(CD.Info1 AS INT) = P.PreInsurerId"
                            + " Where P.CompanyType = 1 And P.ServiceType = 100 AND CD.RefCEUserId = " + txtCustomerId.Text + " And CD.CECarId= " + txtCarId.Text;
                _dtSelect = _db.GetDataTable(_strSelect);
                if (_dtSelect != null && _dtSelect.Rows.Count > 0)
                {
                    lblCarMakeModel.Text = _dtSelect.Rows[0]["MakeModelDesc"].ToString();
                    if (lblCarMakeModel.Text.Length > 30)
                    {
                        lblCarMakeModel.Font.Size = new FontUnit(8);
                    }
                    else
                    {
                        lblCarMakeModel.Font.Size = new FontUnit(9);
                    }

                    if (_dtSelect.Rows[0]["IsPeak"].ToString() == "True")
                    {
                        lblOffpeak.Text = "Yes";
                    }
                    else
                    {
                        lblOffpeak.Text = "No";
                    }

                    //lblOffpeak.Text = _dtSelect.Rows[0]["IsPeak"].ToString() + ", CustID: " + txtCustomerId.Text + ", CarID: " + txtCarId.Text; ;

                    //lblOffpeak.Text = _dtSelect.Rows[0]["IsPeak"].ToString() == "1" ? "Yes" : "No";
                    
                    lblRegYear.Text = _dtSelect.Rows[0]["RegYear"].ToString();
                    lblCurrentInsurer.Text = _dtSelect.Rows[0]["CurrentInsurer"].ToString();

                    if (_dtSelect.Rows[0]["Info17"] != DBNull.Value && _dtSelect.Rows[0]["Info17"].ToString().Length > 0)
                    {
                        lblVehicleNo.Text = _dtSelect.Rows[0]["Info17"].ToString();
                    }
                    else
                    {
                        lblVehicleNo.Text = "N/A";
                    }
                }

                _dtSelect = null;
                _dtSelect = new DataTable("dtSelect");
                bool _IsClaim = false;
                bool _IsAddDriver = false;

                _strSelect = "Select CoverageCommenceDate, Info1 AS NCDPercent, IsClaimLastThreeYear, IsOffDriveCom, IsAddDriver, NoOfDriver from tblCarPolicy"
                    + " Where RefCEUserId = " + txtCustomerId.Text + " And CECarId= " + txtCarId.Text;
                _dtSelect = _db.GetDataTable(_strSelect);
                if (_dtSelect != null && _dtSelect.Rows.Count > 0)
                {
                    lblNCD.Text = _dtSelect.Rows[0]["NCDPercent"].ToString() == "-1" ? "0" : _dtSelect.Rows[0]["NCDPercent"].ToString() + "%";
                    lblOFD.Text = Convert.ToBoolean(_dtSelect.Rows[0]["IsOffDriveCom"].ToString()) == true ? "Yes" : "No";
                    _IsClaim = Convert.ToBoolean(_dtSelect.Rows[0]["IsClaimLastThreeYear"].ToString());
                    _IsAddDriver = Convert.ToBoolean(_dtSelect.Rows[0]["IsAddDriver"].ToString());
                    if (_IsAddDriver == true)
                    {
                        lblDriverCount.Text = _dtSelect.Rows[0]["NoOfDriver"].ToString();
                    }
                    else
                    {
                        lblDriverCount.Text = "0";
                    }

                    DateTime _dtNewCommDate = Convert.ToDateTime(_dtSelect.Rows[0]["CoverageCommenceDate"].ToString());
                    if (DateTime.Compare(_dtNewCommDate, DateTime.Now) >= 0)
                    {
                        lblNewCommDate.Text = "<b style='color:green;'>" + _dtNewCommDate.ToString("dd/MMM/yyyy") + "</b>";
                    }
                    else
                    {
                        lblNewCommDate.Text = "<b style='color:red;'>" + _dtNewCommDate.ToString("dd/MMM/yyyy") + "</b>";
                    }
                }

                _dtSelect = null;
                _dtSelect = new DataTable("dtSelect");


                if (_IsClaim)
                {
                    _strSelect = "select (NOCLast3 + NOCLast2 + NOCLast1) ClaimCount, (Cast(NOCLast1Value as float) + Cast(NOCLast2Value as float) + Cast(NOCLast3Value as float)) ClaimAmount from tblCarClaimHistory"
                    + " Where RefCEUserId = " + txtCustomerId.Text + " And CECarId= " + txtCarId.Text;
                    _dtSelect = _db.GetDataTable(_strSelect);
                    if (_dtSelect != null && _dtSelect.Rows.Count > 0)
                    {
                        lblClaimInfo.Text = "Yes (Count: " + _dtSelect.Rows[0]["ClaimCount"].ToString() + " / Amount: " + Convert.ToDouble(_dtSelect.Rows[0]["ClaimAmount"].ToString()).ToString("$#,000.00") + ")";
                    }
                }
                else
                {
                    lblClaimInfo.Text = "No Claim";
                }


                _db = null;
                _dtSelect = null;
                divCallStatus.Visible = true;
                divCustomerPolicyDetail.Visible = true;
                Int32 CallTypeId = 129;
                CallStatus CI_callstatus = new CallStatus();
                CallStatusDB CI_callstatusdb = new CallStatusDB();
                CI_callstatus = CI_callstatusdb.GetCallStatus(Convert.ToInt64(txtCarId.Text), Convert.ToInt64(txtCustomerId.Text), CallTypeId);

                if (CI_callstatus != null)
                {
                    ddlCallFor.Text = "100";
                    txtCXCRMId.Text = CI_callstatus.CXCRMId.ToString();
                    ddlCICallStatus.Text = CI_callstatus.AgentCallStatus.ToString();
                    txtCIRemark.Text = Server.HtmlDecode(CI_callstatus.Remark);
                    txtCIRemark.Visible = true;
                    ddlCallFor_SelectedIndexChanged(null, null);
                }
                else
                {
                    txtCXCRMId.Text = "0";
                }

                PACallStatus PA_callstatus = new PACallStatus();
                PACallStatusDB PA_callstatusdb = new PACallStatusDB();
                PA_callstatus = PA_callstatusdb.GetCallStatus(Convert.ToInt64(txtCarId.Text), Convert.ToInt64(txtCustomerId.Text));

                if (PA_callstatus != null)
                {
                    ddlPACallStatus.Text = PA_callstatus.AgentCallStatus.ToString();
                    txtCallStatusId.Text = PA_callstatus.CallStatusId.ToString();
                    txtPARemark.Text = Server.HtmlDecode(PA_callstatus.Remark);
                    if (CI_callstatus == null)
                    {
                        ddlCallFor.Text = "200";
                        ddlCallFor_SelectedIndexChanged(null, null);
                    }
                }
                else
                {
                    txtCallStatusId.Text = "0";
                }

                //Sakthi on 07 Jan 2011 -- Start
                Int64 ProviderCompanyId = Convert.ToInt64(ddlProviderCompany.Text);
                DataSet _dsCallStatus = CI_callstatusdb.GetCallStatusDS(Convert.ToInt64(txtCarId.Text), Convert.ToInt64(txtCustomerId.Text), 101, ProviderCompanyId);
                if (_dsCallStatus != null && _dsCallStatus.Tables.Count > 0)
                {
                    if (_dsCallStatus.Tables[0].Rows.Count > 0)
                    {
                        pnlCallStatus.Visible = true;
                        txtCallStatus.Text = Server.HtmlDecode(_dsCallStatus.Tables[0].Rows[0]["Remark"].ToString());
                    }
                    else
                    {
                        pnlCallStatus.Visible = false;
                    }
                }
                else
                {
                    pnlCallStatus.Visible = false;
                }
                //Sakthi on 07 Jan 2011 -- End
                CI_callstatus = null;
                CI_callstatusdb = null;

                PA_callstatus = null;
                PA_callstatusdb = null;

            }
        }
    }

    public void LoadLiberty()
    {
        //CarInsuranceDB _carinsurancedb = new CarInsuranceDB();

        //grvLiberty.DataSource = _carinsurancedb.GetCarInsuranceItemList(Convert.ToInt64(Session[CE.Global.General.ProviderCompanyId].ToString()));
        //grvLiberty.DataBind();

    }

    protected void ibtSubmit_Click(object sender, EventArgs e)
    {
        txtCallStatusId.Text = "";
        txtCarId.Text = "";
        txtCustomerId.Text = "";
        txtCarPolicyId.Text = "";
        txtCIRemark.Text = "";
        txtPARemark.Text = "";

        hplReRunQuote.NavigateUrl = "";
        hplNewQuote.NavigateUrl = "";
        grvCarInsurance.DataBind();
        grvCarInsuranceCheapestQuote.DataBind();

        lblCallStatusMessage.Text = "";
        divCallStatus.Visible = false;
        divCustomerPolicyDetail.Visible = false;
    }

    protected void btnCallStatus_Click(object sender, EventArgs e)
    {
        lblCallStatusMessage.Text = "";
        Page.Validate();
        if (Page.IsValid)
        {
            if (txtCarId.Text.Length > 0 && txtCustomerId.Text.Length > 0)
            {
                if (ddlCallFor.Text == "100")
                {
                    CallStatus callstatus = new CallStatus();
                    CallStatusDB callstatusdb = new CallStatusDB();
                    if (txtCXCRMId.Text.Length > 0 && txtCXCRMId.Text != "0")
                    {
                        callstatus.CXCRMId = Convert.ToInt64(txtCXCRMId.Text);
                    }
                    else
                    {
                        callstatus.CXCRMId = 0;
                    }
                    callstatus.CarId = Convert.ToInt64(txtCarId.Text);
                    callstatus.CustomerId = Convert.ToInt64(txtCustomerId.Text);
                    callstatus.AgentId = Convert.ToInt64(txtAgentId.Text);
                    callstatus.AgentCallStatus = Convert.ToInt32(ddlCICallStatus.Text);
                    callstatus.CallTypeId = 129;
                    callstatus.Remark = Server.HtmlEncode(txtCIRemark.Text);
                    callstatus.CXCRMId = callstatusdb.Insert(callstatus);
                    if (callstatus.CXCRMId > 0)
                    {
                        if (txtCXCRMId.Text.Length > 0 && txtCXCRMId.Text != "0")
                        {
                            lblCallStatusMessage.Text = "UPDATE";
                        }
                        else
                        {
                            txtCXCRMId.Text = callstatus.CXCRMId.ToString();
                            lblCallStatusMessage.Text = "SUCCESS";
                        }
                    }
                    else
                    {
                        lblCallStatusMessage.Text = "FAIL";
                    }
                    callstatus = null;
                    callstatusdb = null;
                }
                else if (ddlCallFor.Text == "200")
                {
                    PACallStatus callstatus = new PACallStatus();
                    PACallStatusDB callstatusdb = new PACallStatusDB();
                    if (txtCallStatusId.Text.Length > 0 && txtCallStatusId.Text != "0")
                    {
                        callstatus.CallStatusId = Convert.ToInt64(txtCallStatusId.Text);
                    }
                    else
                    {
                        callstatus.CallStatusId = 0;
                    }
                    callstatus.CarId = Convert.ToInt64(txtCarId.Text);
                    callstatus.CIProviderCompanyId = Convert.ToInt64(ddlProviderCompany.Text);
                    callstatus.CustomerId = Convert.ToInt64(txtCustomerId.Text);
                    callstatus.ContactNo = txtContactNo.Text;
                    callstatus.CIQuoteRefNo = "CI-NORMAL";//txtCIQuoteRefNo.Text;
                    callstatus.CallTypeId = 200;
                    callstatus.AgentId = Convert.ToInt64(txtAgentId.Text);
                    callstatus.AgentCallStatus = Convert.ToInt32(ddlPACallStatus.Text);
                    callstatus.Remark = Server.HtmlEncode(txtPARemark.Text);
                    callstatus.CallStatusId = callstatusdb.Insert(callstatus);
                    if (callstatus.CallStatusId > 0)
                    {
                        if (txtCallStatusId.Text.Length > 0 && txtCallStatusId.Text != "0")
                        {
                            lblCallStatusMessage.Text = "UPDATE";
                        }
                        else
                        {
                            txtCallStatusId.Text = callstatus.CallStatusId.ToString();
                            lblCallStatusMessage.Text = "SUCCESS";
                        }
                    }
                    else
                    {
                        lblCallStatusMessage.Text = "FAIL";
                    }
                    callstatus = null;
                    callstatusdb = null;
                }
                else
                {
                    lblCallStatusMessage.Text = "FAIL";
                }
            }
            else
            {
                lblCallStatusMessage.Text = "FAIL";
            }
        }
    }

    protected void grvCarInsurance_PageIndexChanged(object sender, EventArgs e)
    {
        txtCustomerId.Text = string.Empty;
        txtCarId.Text = string.Empty;
        divCallStatus.Visible = false;
        divCustomerPolicyDetail.Visible = false;
        grvCarInsurance.SelectedIndex = -1;
        grvCarInsuranceCheapestQuote.DataBind();
    }

    protected void ddlCommenceDate_SelectedIndexChanged(object sender, EventArgs e)
    {
        ibtSubmit_Click(sender, e);
    }

    protected void ddlProviderCompany_SelectedIndexChanged(object sender, EventArgs e)
    {
        ibtSubmit_Click(sender, e);
        UpdateScriptUrl();
        SetCarInsuranceRunNewCustomerAndQuoteLink();
    }

    private void UpdateScriptUrl()
    {
        if (ddlProviderCompany.Text == "29")
        {
            //pnlPA.Visible = false;
            //hplPANewQuote.Visible = false;
            //hplPANewUser.Visible = false;
            //hplPAViewScript.Visible = false;
            hplViewScript.NavigateUrl = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CXCRMCILibertyScriptUrl");
        }
        else if (ddlProviderCompany.Text == "30")
        {
            //pnlPA.Visible = true;
            //hplPANewQuote.Visible = true;
            //hplPANewUser.Visible = true;
            //hplPAViewScript.Visible = true;
            hplViewScript.NavigateUrl = CE.Configuration.MyConfigurationManager.GetAppSettingValue("CXCRMCIEtiqaScriptUrl");
        }
    }

    protected void ddlCallFor_SelectedIndexChanged(object sender, EventArgs e)
    {
        btnCallStatus.Enabled = true;
        lblCallStatusMessage.Text = "";
        ddlCICallStatus.Enabled = true;
        ddlPACallStatus.Enabled = true;
        txtCIRemark.Enabled = true;
        txtPARemark.Enabled = true;
        btnCallStatus.Enabled = true;

        if (grvCarInsurance.Rows.Count > 0 && grvCarInsurance.SelectedIndex >= 0)
        {
            if (ddlCallFor.Text == "200")
            {

                ddlCICallStatus.Visible = false;
                rfvCICallStatus.Enabled = false;

                ddlPACallStatus.Visible = true;
                rfvPACallStatus.Enabled = true;

                txtCIRemark.Visible = false;
                txtPARemark.Visible = true;

                if (ddlProviderCompany.Text == "29")
                {
                    lblCallStatusMessage.Text = "Not allow for " + ddlProviderCompany.SelectedItem.Text;
                    btnCallStatus.Enabled = false;
                    ddlPACallStatus.Enabled = false;
                    txtPARemark.Enabled = false;
                }
            }
            else if (ddlCallFor.Text == "100")
            {
                ddlCICallStatus.Visible = true;
                rfvCICallStatus.Enabled = true;

                ddlPACallStatus.Visible = false;
                rfvPACallStatus.Enabled = false;

                txtCIRemark.Visible = true;
                txtPARemark.Visible = false;
            }
            else
            {
                ddlCICallStatus.Enabled = false;
                ddlPACallStatus.Enabled = false;
                txtCIRemark.Enabled = false;
                txtPARemark.Enabled = false;
                btnCallStatus.Enabled = false;
            }
        }
    }
    protected void grvCarInsuranceCheapestQuote_RowCreated(object sender, GridViewRowEventArgs e)
    {

    }

    protected void grvCarInsuranceCheapestQuote_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //Response.Write("Bounded");
    }
}
